/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package GUI;

import beans.Adresse;
import beans.Finanzamt;
import beans.Unternehmen;

/**
 *
 * @author Thomas
 */
public class FirmenDaten extends javax.swing.JDialog {
    
    private boolean ok;
    private Unternehmen unternehmen;
    /**
     * Creates new form FirmenDatenDLG
     */
    public FirmenDaten(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        this.setTitle("Unternehmen-Stammdaten");
        this.setLocationRelativeTo(null);
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jPanel1 = new javax.swing.JPanel();
        jLabel1 = new javax.swing.JLabel();
        tfBezeichnung = new javax.swing.JTextField();
        jLabel2 = new javax.swing.JLabel();
        jLabel11 = new javax.swing.JLabel();
        jLabel12 = new javax.swing.JLabel();
        tfStrasse = new javax.swing.JTextField();
        jLabel13 = new javax.swing.JLabel();
        jPanel2 = new javax.swing.JPanel();
        tfPLZ = new javax.swing.JTextField();
        tfOrt = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        tfTelNR = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        tfFax = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        tfMail = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        jLabel15 = new javax.swing.JLabel();
        jLabel16 = new javax.swing.JLabel();
        tfFinBez = new javax.swing.JTextField();
        jLabel17 = new javax.swing.JLabel();
        tfFinNr = new javax.swing.JTextField();
        jLabel18 = new javax.swing.JLabel();
        tfFinSteuerNr = new javax.swing.JTextField();
        jLabel9 = new javax.swing.JLabel();
        tfUID = new javax.swing.JTextField();
        jLabel10 = new javax.swing.JLabel();
        tfDVR = new javax.swing.JTextField();
        jLabel14 = new javax.swing.JLabel();
        tfIBAN = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        jLabel8 = new javax.swing.JLabel();
        jLabel19 = new javax.swing.JLabel();
        jLabel20 = new javax.swing.JLabel();
        jLabel21 = new javax.swing.JLabel();
        tfBankStrasse = new javax.swing.JTextField();
        jLabel22 = new javax.swing.JLabel();
        jPanel3 = new javax.swing.JPanel();
        tfBankPLZ = new javax.swing.JTextField();
        tfBankOrt = new javax.swing.JTextField();
        jLabel23 = new javax.swing.JLabel();
        tfBLZ = new javax.swing.JTextField();
        jLabel24 = new javax.swing.JLabel();
        tfBankKonto = new javax.swing.JTextField();
        jLabel25 = new javax.swing.JLabel();
        tfBankTel = new javax.swing.JTextField();
        jLabel26 = new javax.swing.JLabel();
        tfBankFax = new javax.swing.JTextField();
        jLabel27 = new javax.swing.JLabel();
        tfKrankenk = new javax.swing.JTextField();
        btAbbrechen = new javax.swing.JButton();
        btFertig = new javax.swing.JButton();
        jMenuBar1 = new javax.swing.JMenuBar();
        jMenu1 = new javax.swing.JMenu();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jPanel1.setLayout(new java.awt.GridLayout(0, 2));

        jLabel1.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
        jLabel1.setText("Firmen-Name:");
        jPanel1.add(jLabel1);

        tfBezeichnung.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
        jPanel1.add(tfBezeichnung);

        jLabel2.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
        jLabel2.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel2.setText("Adresse:");
        jPanel1.add(jLabel2);
        jPanel1.add(jLabel11);

        jLabel12.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel12.setText("Straße:");
        jPanel1.add(jLabel12);
        jPanel1.add(tfStrasse);

        jLabel13.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel13.setText("PLZ/Ort:");
        jPanel1.add(jLabel13);

        jPanel2.setLayout(new java.awt.GridLayout(1, 2));

        tfPLZ.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        jPanel2.add(tfPLZ);
        jPanel2.add(tfOrt);

        jPanel1.add(jPanel2);

        jLabel3.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
        jLabel3.setText("Telefonnummer:");
        jPanel1.add(jLabel3);

        tfTelNR.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
        jPanel1.add(tfTelNR);

        jLabel4.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
        jLabel4.setText("FAX:");
        jPanel1.add(jLabel4);

        tfFax.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
        jPanel1.add(tfFax);

        jLabel6.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
        jLabel6.setText("e-mail:");
        jPanel1.add(jLabel6);

        tfMail.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
        jPanel1.add(tfMail);

        jLabel7.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
        jLabel7.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel7.setText("Finanzamt:");
        jPanel1.add(jLabel7);
        jPanel1.add(jLabel15);

        jLabel16.setText("Bezeichnung:");
        jPanel1.add(jLabel16);
        jPanel1.add(tfFinBez);

        jLabel17.setText("Nummer:");
        jPanel1.add(jLabel17);
        jPanel1.add(tfFinNr);

        jLabel18.setText("Steuernummer:");
        jPanel1.add(jLabel18);
        jPanel1.add(tfFinSteuerNr);

        jLabel9.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
        jLabel9.setText("UID-Nummer:");
        jPanel1.add(jLabel9);

        tfUID.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
        jPanel1.add(tfUID);

        jLabel10.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
        jLabel10.setText("DVR-Nummer:");
        jPanel1.add(jLabel10);

        tfDVR.setFont(new java.awt.Font("Arial", 0, 14)); // NOI18N
        jPanel1.add(tfDVR);

        jLabel14.setText("IBAN:");
        jPanel1.add(jLabel14);
        jPanel1.add(tfIBAN);

        jLabel5.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
        jLabel5.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel5.setText("Bank:");
        jPanel1.add(jLabel5);
        jPanel1.add(jLabel8);

        jLabel19.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
        jLabel19.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel19.setText("Adresse:");
        jPanel1.add(jLabel19);
        jPanel1.add(jLabel20);

        jLabel21.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel21.setText("Straße:");
        jPanel1.add(jLabel21);
        jPanel1.add(tfBankStrasse);

        jLabel22.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel22.setText("PLZ/Ort:");
        jPanel1.add(jLabel22);

        jPanel3.setLayout(new java.awt.GridLayout(1, 2));

        tfBankPLZ.setHorizontalAlignment(javax.swing.JTextField.RIGHT);
        jPanel3.add(tfBankPLZ);
        jPanel3.add(tfBankOrt);

        jPanel1.add(jPanel3);

        jLabel23.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel23.setText("BLZ:");
        jPanel1.add(jLabel23);
        jPanel1.add(tfBLZ);

        jLabel24.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel24.setText("Kontonummer:");
        jPanel1.add(jLabel24);
        jPanel1.add(tfBankKonto);

        jLabel25.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel25.setText("Tel.:");
        jPanel1.add(jLabel25);
        jPanel1.add(tfBankTel);

        jLabel26.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel26.setText("Fax:");
        jPanel1.add(jLabel26);
        jPanel1.add(tfBankFax);

        jLabel27.setFont(new java.awt.Font("Arial", 1, 14)); // NOI18N
        jLabel27.setHorizontalAlignment(javax.swing.SwingConstants.RIGHT);
        jLabel27.setText("Krankenkasse:");
        jPanel1.add(jLabel27);
        jPanel1.add(tfKrankenk);

        btAbbrechen.setFont(new java.awt.Font("Verdana", 1, 18)); // NOI18N
        btAbbrechen.setText("Abbrechen");
        btAbbrechen.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                onAbbrechen(evt);
            }
        });
        jPanel1.add(btAbbrechen);

        btFertig.setFont(new java.awt.Font("Verdana", 1, 18)); // NOI18N
        btFertig.setText("Übernehmen");
        btFertig.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                onUebernehmen(evt);
            }
        });
        jPanel1.add(btFertig);

        getContentPane().add(jPanel1, java.awt.BorderLayout.CENTER);

        jMenu1.setText("Hilfe");
        jMenuBar1.add(jMenu1);

        setJMenuBar(jMenuBar1);

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void onUebernehmen(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_onUebernehmen
        ok = true;
        //Unternehmen(int untID, String untBez, String untTelNr, String untFaxNr, 
        //String untUIDNr, String untDVRNr, String untIBAN, Adresse untAdr,
        //String untEmail, Finanzamt untFin, Kreditinstitut untKre, Krankenkasse untKrank)
        
        // Finanzamt, Kreditinstitut untKre, Krankenkasse untKrank
        unternehmen = new Unternehmen(0,tfBezeichnung.getText(), tfTelNR.getText(), 
                tfFax.getText(), tfUID.getText(), tfDVR.getText(), 
                tfIBAN.getText(), new Adresse(tfStrasse.getText(), 
                tfPLZ.getText(), tfOrt.getText()), tfMail.getText(), new Finanzamt(0, tfFinBez.getText(), tfFinNr.getText(), tfFinSteuerNr.getText()),null, null);
        this.dispose();
    }//GEN-LAST:event_onUebernehmen

    private void onAbbrechen(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_onAbbrechen
        ok = false;
        this.setVisible(false);
        this.dispose();
    }//GEN-LAST:event_onAbbrechen

    public boolean isOk() {
        return ok;
    }

    public Unternehmen getUnternehmen() {
        return unternehmen;
    }
    
    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(FirmenDaten.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(FirmenDaten.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(FirmenDaten.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(FirmenDaten.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the dialog */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                FirmenDaten dialog = new FirmenDaten(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {
                    @Override
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btAbbrechen;
    private javax.swing.JButton btFertig;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel10;
    private javax.swing.JLabel jLabel11;
    private javax.swing.JLabel jLabel12;
    private javax.swing.JLabel jLabel13;
    private javax.swing.JLabel jLabel14;
    private javax.swing.JLabel jLabel15;
    private javax.swing.JLabel jLabel16;
    private javax.swing.JLabel jLabel17;
    private javax.swing.JLabel jLabel18;
    private javax.swing.JLabel jLabel19;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel20;
    private javax.swing.JLabel jLabel21;
    private javax.swing.JLabel jLabel22;
    private javax.swing.JLabel jLabel23;
    private javax.swing.JLabel jLabel24;
    private javax.swing.JLabel jLabel25;
    private javax.swing.JLabel jLabel26;
    private javax.swing.JLabel jLabel27;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    private javax.swing.JLabel jLabel9;
    private javax.swing.JMenu jMenu1;
    private javax.swing.JMenuBar jMenuBar1;
    private javax.swing.JPanel jPanel1;
    private javax.swing.JPanel jPanel2;
    private javax.swing.JPanel jPanel3;
    private javax.swing.JTextField tfBLZ;
    private javax.swing.JTextField tfBankFax;
    private javax.swing.JTextField tfBankKonto;
    private javax.swing.JTextField tfBankOrt;
    private javax.swing.JTextField tfBankPLZ;
    private javax.swing.JTextField tfBankStrasse;
    private javax.swing.JTextField tfBankTel;
    private javax.swing.JTextField tfBezeichnung;
    private javax.swing.JTextField tfDVR;
    private javax.swing.JTextField tfFax;
    private javax.swing.JTextField tfFinBez;
    private javax.swing.JTextField tfFinNr;
    private javax.swing.JTextField tfFinSteuerNr;
    private javax.swing.JTextField tfIBAN;
    private javax.swing.JTextField tfKrankenk;
    private javax.swing.JTextField tfMail;
    private javax.swing.JTextField tfOrt;
    private javax.swing.JTextField tfPLZ;
    private javax.swing.JTextField tfStrasse;
    private javax.swing.JTextField tfTelNR;
    private javax.swing.JTextField tfUID;
    // End of variables declaration//GEN-END:variables
}
